package com.aspsine.multithreaddownload;

import com.aspsine.multithreaddownload.demo.CrashHandler;
import ohos.aafwk.ability.AbilityPackage;
import ohos.app.Context;

public class App extends AbilityPackage {

    private static Context mContext;

    @Override
    public void onInitialize(){
        super.onInitialize();
        mContext = getApplicationContext();
        initDownloader();
        CrashHandler.getInstance(mContext);
    }

    private void initDownloader() {
        DownloadConfiguration configuration = new DownloadConfiguration();
        configuration.setMaxThreadNum(10);
        configuration.setThreadNum(3);
        DownloadManager.getInstance().init(getApplicationContext(), configuration);
    }

    public static Context getGlobalContext(){
        return mContext;
    }
}
